package com.qf5.web;

import com.github.pagehelper.PageInfo;
import com.qf5.domain.Student;
import com.qf5.service.StudentService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class StudentController {
    public static void main(String[] args) {
        //获取ioc容器
        ApplicationContext ioc = new ClassPathXmlApplicationContext("spring.xml");
        //获取service对象
        StudentService studentService = ioc.getBean(StudentService.class);

        //执行操作
//        List<Student> students = studentService.findAll();

//        students.forEach(System.out::println);

//        PageInfo<Student> page = studentService.findPage(2, 5);
//        System.out.println(page);

        Student stu = studentService.findById(1);
        stu.setName("张三");

        int update = studentService.update(stu);
        System.out.println(update);
    }
}
